//
//  RefundBtnPartialView.m
//  ios-supplier
//
//  Created by feynmanyuan on 15/4/20.
//  Copyright (c) 2015年 feynmanyuan. All rights reserved.
//

#import "RefundBtnPartialView.h"
@interface RefundBtnPartialView()
- (IBAction)refundAction:(id)sender;
//@property (weak, nonatomic) IBOutlet UIButton *okBtn;
@property (weak, nonatomic) IBOutlet UILabel *refundMoneyLabel;
@property (weak, nonatomic) IBOutlet UILabel *refundTipsLabel;
@end

@implementation RefundBtnPartialView
- (void)setOrder:(JFBOrderDS*)order{
    [self setBackgroundColor:[UIColor whiteColor]];
    CGFloat y = (cDetailBottomHeight - self.refundTipsLabel.bounds.size.height) / 2;
    
    CGRect refundTipsRect = CGRectMake(kOrderCellSpacing, y , self.refundTipsLabel.bounds.size.width, self.refundTipsLabel.bounds.size.height);
    self.refundTipsLabel.frame = refundTipsRect;
    
    NSString *money = [NSString stringWithFormat:@"¥ %@", [NSString decimalToString:order.money]];
    CGSize moneySize = [money sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:TextFontSizeH2]}];
    CGFloat moneyX = CGRectGetMaxX(self.refundTipsLabel.frame) + kOrderCellSpacing / 2;
    CGRect moneyRect = CGRectMake(moneyX, y, moneySize.width, moneySize.height);
    self.refundMoneyLabel.text = money;
    self.refundMoneyLabel.frame = moneyRect;
    
//    CGRect okRect = CGRectMake(self.bounds.size.width * 0.75, 0, self.bounds.size.width / 4, cDetailBottomHeight);
//    self.okBtn.frame = okRect;
//    self.okBtn.titleLabel.textColor = [UIColor whiteColor];
//    [self.okBtn setBackgroundColor:ButtonBgColorImportant];
    
    self.height = cDetailBottomHeight;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (IBAction)refundAction:(id)sender {
    [[NSNotificationCenter defaultCenter] postNotificationName:@"orderDetailForAction" object:self userInfo:[NSDictionary dictionaryWithObject:@"refund" forKey:@"event"]];
}
@end
